<template>
	<el-drawer title="项目问题反馈详情" v-model="visible" :size="800" destroy-on-close @closed="$emit('closed')">
		<el-container v-loading="loading">
			<el-main>
				<el-form>
					<el-form-item label="问题标题">{{ form.title }}
					</el-form-item>
					<el-form-item label="问题类型">{{ form.problemTypeName }}
					</el-form-item>
					<el-form-item label="问题描述">{{ form.remark }}
					</el-form-item>
					<el-form-item label="相关附件">
						<attach-menu :attachIds="form.attachId" :roleFlag="3" :preview="true"></attach-menu>
					</el-form-item>
				</el-form>
				<el-divider content-position="center">回复列表</el-divider>
				<scTable ref="table" :data="replyList" row-key="recordId" stripe remoteSort remoteFilter>
					<el-table-column label="#" type="index" width="50"></el-table-column>
					<el-table-column label="回复内容" prop="remark" width="300" :show-overflow-tooltip="true"></el-table-column>
					<el-table-column label="相关附件" prop="attachId" width="200" :show-overflow-tooltip="true">
						<template #default="scope">
							<attach-menu :attachIds="scope.row.attachId" :roleFlag="3" :preview="true"></attach-menu>
						</template>
					</el-table-column>
					<el-table-column label="回复时间" prop="createTime" width="150"></el-table-column>
					<el-table-column label="回复人" prop="createUserName" width="100"></el-table-column>
				</scTable>
				<el-footer style="text-align: center;">
					<el-button @click="visible=false">关闭</el-button>
				</el-footer>
			</el-main>
		</el-container>
	</el-drawer>
</template>
<script>
import AttachMenu from '@/views/module/attachMenu'

export default {
	emits: ['success', 'closed'],
	components: {AttachMenu},
	data() {
		return {
			visible: false,
			isSaveing: false,
			//所需数据选项
			fileList: [],
			replyList: [],
			apiObj: this.$API.file.attach.uploadFile,
			form: {
				title: '',
				problemTypeName: '',
				remark: '',
				attachId: '',
			},
			repForm:{
				problemId:'',
				attachId:'',
				remark:""
			},
		}
	},
	mounted() {
	},
	methods: {
		open() {
			this.visible = true;
			return this
		},
		async getProblemReplyList() {
			var res = await this.$API.project.proProblemReply.getProblemReplyList.get({problemId: this.repForm.problemId});
			if (res.code == 200) {
				this.replyList = res.data;
			} else {
				this.$alert(res.message, "提示", {type: 'error'})
			}
		},
		setData(data) {
			this.repForm.problemId = data.recordId
			this.form.title = data.title
			this.form.problemTypeName = data.problemTypeName
			this.form.remark = data.remark
			this.form.attachId = data.attachId
			this.getProblemReplyList();
		},
	}
}
</script>

<style>
.customWidth {
	width: 60%;
}
</style>
